package com.itheima.api;

public class Demo1 {
    public static void main(String[] args) {
       int a= Math.abs(2);//返回绝对值int
        double b=  Math.floor(5.6);//向下取整
        double c=Math.ceil(5.0);//向上取整
        double d=Math.pow(2.1,3);//a的b次幂(double,double)
     long e = Math.round(5.6);//四舍五入返回的仍然是double只看小数点第一位
     double f = Math.random();//0.0到1.0的随机数
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
        System.out.println(e);
        System.out.println(f);

        System.out.println("..........");
        int arr[]=new int[]{1,2,3,4,5};
        double r=Math.random()*5;
       int index= (int)(Math.round(r));
        System.out.println(".........");
        int[] arr1={1,2,3,4,5};
        int[] arr2=new int[8];

        System.arraycopy(arr1,1,arr2,3,3);
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
        System.out.println("...............");


    }

}
